<!DOCTYPE html>
<html>
<head>
	<title></title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">
	<link href="http://cdn.gbtags.com/twitter-bootstrap/3.2.0/css/bootstrap.css" rel="stylesheet">
</head>
<body onload="show()">
<div class="container-fluid">
	<button class="btn" type="button" name="index" style="background: #00b4ef; position: absolute; top: 15px;right: 50px;"><a href="/Home/Login/login">首页</a></button>
	<button class="btn btn-success" type="button" name="whitelist" style="background: #660099; position: absolute; top: 50px;right: 50px;"><a href="/Home/Hard/whitelist">白名单管理</a></button>
	<div class="row-fluid">
		<div class="span12">
			<h1>固件更新</h1>
			<ul class="nav nav-tabs">
				<li>
					<a href="/Home/Hard/pubshow">发布记录</a>
				</li>
				<li class="">
					<a href="/Home/Hard/index">上传版本</a>
				</li>
				<li class="active">
					<a href="#">白名单测试</a>
				</li>
				<li class="">
					<a href="/Home/Hard/confirm">正式发布</a>
				</li>
			</ul>
		</div>
	</div>
	<table class="table" >
		<thead>
		<tr>
			<th>
				ID
			</th>
			<th>
				发布系统
			</th>
			<th>
				发布版本
			</th>
			<th>
				版本大小
			</th>
			<th>
				弹窗文案
			</th>
			<th>
				系统通知
			</th>
			<th>
				url
			</th>
			<th>
				生成时间
			</th>
		</tr>
		</thead>
		<tbody>
		<volist name="data" id="ls">
			<tr>
				<td>
					{$ls.id}
				</td>
				<td>
					{$ls.sys}
				</td>
				<td>
					{$ls.version}
				</td>
				<td>
					{$ls.size}
				</td>
				<td>
					<textarea type="text"  class="doc" name="doc" cols="40" rows="10">{$ls.doc}</textarea>
				</td>
				<td>
					<textarea type="text"  class="sysinfo" name="sysinfo" cols="40" rows="10">{$ls.sysinfo}</textarea>
				</td>
				<td>
					<textarea type="text"  class="doc" name="doc" cols="30" rows="4" disabled="disabled" readonly="readonly" style="BORDER-BOTTOM: 0px solid; BORDER-LEFT: 0px solid; BORDER-RIGHT: 0px solid; BORDER-TOP: 0px solid;">{$ls.url}</textarea>
				</td>
				<td>
					{$ls.createtime|date="Y-m-d,H:i",###}
				</td>
				<td>
					<div style="visibility: hidden" name="hidden">
						<button class="btn btn-warning" type="button" id="save" name="{$ls.id}" style="float: left; clear: both">下一步</button>
						<button class="btn btn-danger" type="button" name="{$ls.id}" onclick="eventshelf(this.name)" style="float: left; clear: both">驳回</button>
					</div>
					<button class="btn btn-success" type="button" name="upload" style="float: left; clear: both"><a href="{$ls.url}" >下载</a> </button>
				</td>
			</tr>
		</volist>
		</tbody>

	</table>
	<div class="page" style="text-align: center;" >
		{$_page}
	</div>
	<div>
	</div>

</div>
</body>
<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="//cdn.bootcss.com/jquery/2.1.4/jquery.min.js"></script>
<script src="//cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script src="bootstrap-table-zh-CN.js"></script>
<script>
    $(function () {
        $(".btn-warning").click(function(){
            var r=confirm("确认更新？");
            if(r == true){
                var id = document.getElementById('save').name;
                var doc = $(this).parent().parent().find(".doc").val();
                var sysinfo = $(this).parent().parent().find(".sysinfo").val();
                $.post('/Home/Hard/white_upload',{id:id,doc:doc,sysinfo:sysinfo},function(data){
                    if (data.status > 0) {
                        alert('更新成功！');
                        window.location.reload();
                    } else {
                        alert('更新失败！');
                        window.location.reload();
                    }
                })
            }
        })

    })

    function jump(){
        window.location.href='/Home/Login/login';
    }

    //    function jump_white() {
    //        window.location.href='/Home/Index/whitelist';
    //    }


    function eventshelf(eve){
        var r=confirm("确认下线？");
        if(r ==true){
            var id = eve;
            $.post('/Home/Hard/shelf',{id:id},function(data){
                if (data.status > 0) {
                    alert('下线成功！');
                    window.location.reload();
                } else {
                    alert('下线失败！');
                    window.location.reload();
                }
            })
        }
    }

    function show() {
        var arr= document.getElementsByName('hidden');
        var aut="{:session('white')}";
        if(aut == true) {
            for (var i = 0; i < arr.length; i++) {
                arr[i].style.visibility = 'visible';
            }
        }
    }
</script>
</html>